#include<bits/stdc++.h>
using namespace std;

int a[100];

signed main() {
    for(int i = 0; i < 24; i++)
        cin >> a[i];

    int x;
    while(cin >> x) {
        if(x < 0 || x > 23)
            break;

        cout << a[x] << " " << (a[x] > 50 ? "Yes" : "No") << "\n";
    }
    return 0;
}

